<?php
include("CrawerURLWindows.php");
include("ParseContentWindows.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
ignore_user_abort();
set_time_limit(0);


$beginurls = array (
//array("windows phone","http://mobile.91.com/soft/wm/list/33_1_5"),                   //角色扮演
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_33/2_5.html"),
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_33/3_5.html"),
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_33/4_5.html"),
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_33/5_5.html"),
//array("windows phone","http://mobile.91.com/soft/wm/list/39_1_5"),                   //其他游戏
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_39/2_5.html"),
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_39/3_5.html"),
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_39/4_5.html"),
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_39/5_5.html"),
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_39/6_5.html"),
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_39/7_5.html"),
//array("windows phone","http://mobile.91.com/soft/wm/list/43_1_5"),                   //体育竞技
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/2_5.html"),            
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/3_5.html"),            
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/4_5.html"),            
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/5_5.html"),            
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/6_5.html"),            
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/7_5.html"),            
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/8_5.html"),            
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/9_5.html"),            
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/10_5.html"),            
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/11_5.html"),            
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/12_5.html"),            
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/13_5.html"),            
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_43/14_5.html"),            
//array("windows phone","http://http://mobile.91.com/soft/wm/list/34_1_5"),            //休闲娱乐          
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/2_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/3_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/4_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/5_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/6_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/7_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/8_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/9_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/10_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/11_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/12_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/13_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/14_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/15_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/16_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/17_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/18_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/19_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/20_5.html"),                    
//array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/21_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/22_5.html"),      //采集到这里ip又被ban了                 
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/23_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/24_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/25_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/26_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/27_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/28_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/29_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/30_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/31_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/32_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/33_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/34_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/35_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/36_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/37_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/38_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/39_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/40_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/41_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/42_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/43_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/44_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/45_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/46_5.html"),                    
array("windows phone","http://mobile.91.com/Soft/wm/list/cate_34/47_5.html")
);

foreach ($beginurls as $url){

	$category = $url[1];
	echo "采集地址==>>".$category;
	$urlpattern = "/<h5>(.*?)href=\"(.*?)\"/";

	//采集出类别页面的全部游戏地址
	$c = new CrawerURLWindows();
	$urls = $c->parseURLS("$category", $urlpattern);

	$p = new ParseContentWindows();

	//匹配每个游戏属性的正则表达式数字
	$regs = array("name" =>"<h3>(.*?)<\/h3>",
	             "date" =>"> 更新日期：(.*?)<\/p>",
	             "size" =>"> 文件大小：(.*?)<\/p>",
	             "introduce" =>"<!--软件说明-->([\s\S]*?)<!--软件说明结束-->",
				 "img" =>"\['(.*?)','"
				 );

				 //29为windowsphone的类别id
				 $cid = 30;
				 //采集出上面一个类别下的全部游戏url的详细信息
				 $p->parseAllContent($urls, $regs,$cid);
}
?>
</body>
</html>
